package lidongp.controller;

import lidongp.entity.BjEntity;
import lidongp.entity.Page;
import lidongp.entity.PageUtils;
import lidongp.entity.lidongpengEntity;
import lidongp.service.lidongpService;
import org.springframework.stereotype.Controller;


import javax.annotation.Resource;
import java.util.List;

@Controller
public class lidongpController {
    lidongpengEntity lidongp;
    String name = null;
    Integer pageNo = null;
    Page page =  null;
    List<BjEntity> bjEntity=null;
    String flag = "0";
    @Resource
    lidongpService lidongpservice;

    public String queryPage(){
        int totalCount= lidongpservice.queryCount(name);
        page = PageUtils.getPage(5,totalCount,pageNo);
        List<lidongpengEntity> list = lidongpservice.queryPage(page,name);
        page.setData(list);
        return "queryPage";
    }

    public String save(){
        lidongpservice.save(lidongp);
        flag = "1";
        return "save";
    }
    public String del(){
        lidongpservice.del(lidongp);
        flag = "1";
        return "save";
    }

    public String edit(){
        lidongp =lidongpservice.edit(lidongp);

        return "edit";
    }

    public String bj(){
        bjEntity =lidongpservice.bj();
        return "bj";
    }

    public lidongpengEntity getLidongp() {
        return lidongp;
    }

    public void setLidongp(lidongpengEntity lidongp) {
        this.lidongp = lidongp;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }

    public List<BjEntity> getBjEntity() {
        return bjEntity;
    }

    public void setBjEntity(List<BjEntity> bjEntity) {
        this.bjEntity = bjEntity;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public lidongpService getLidongpservice() {
        return lidongpservice;
    }

    public void setLidongpservice(lidongpService lidongpservice) {
        this.lidongpservice = lidongpservice;
    }
}
